package cn.edu.hqu.cst.android.hxy.e3;

import androidx.appcompat.app.AppCompatActivity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.widget.TextView;

public class SystemInfoActivity extends AppCompatActivity {
    TextView tvShowOri, tvShowNav, tvShowMnc, tvShowTouch;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_system_info);

        tvShowOri = findViewById(R.id.tv_system_info_activity_ori);
        tvShowNav = findViewById(R.id.tv_system_info_activity_nav);
        tvShowTouch = findViewById(R.id.tv_system_info_activity_touch);
        tvShowMnc = findViewById(R.id.tv_system_info_activity_mnc);

        Configuration cfg = getResources().getConfiguration();
        String screen = cfg.orientation == Configuration.ORIENTATION_LANDSCAPE ? "横向屏幕" : "竖向屏幕";
        String mncCode = String.valueOf(cfg.mnc);
        String naviName = cfg.navigation == Configuration.NAVIGATION_NONAV ? "没有方向控制"
                : cfg.navigation == Configuration.NAVIGATION_WHEEL ? "滚轮控制方向"
                : cfg.navigation == Configuration.NAVIGATION_DPAD ? "方向键控制方向"
                : "轨迹球控制方向";
        String touchName = cfg.touchscreen == Configuration.TOUCHSCREEN_NOTOUCH ? "无触摸屏"
                : cfg.touchscreen == Configuration.TOUCHSCREEN_STYLUS ? "触摸笔式触摸屏"
                : "接受手指的触摸屏";

        tvShowOri.setText(screen);
        tvShowNav.setText(naviName);
        tvShowMnc.setText(mncCode);
        tvShowTouch.setText(touchName);
    }
}
